package org.cx.myweb.dao.impl;

import java.util.List;

import org.cx.myweb.dao.IUserDao;
import org.cx.myweb.vo.User;
import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class UserImpl extends HibernateDaoSupport implements IUserDao {

	@Override
	public void delete(String userid) throws Exception {
	String hql="DELETE FROM User WHERE userid=? ";
	Query q=super.getSession().createQuery(hql);
	q.setString(0, userid);
	q.executeUpdate();

	}

	@Override
	public int getAllCount() throws Exception {
	String hql="SELECT COUNT(u.id) FROM User AS u";
	Query q=super.getSession().createQuery(hql);
	int count=(Integer)q.list().get(0);
		return count;
	}

	@Override
	public boolean login(User user) throws Exception {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public List queryAll(int currentPage, int lineSize) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public User queryByUserId(String userid) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void register(User user) throws Exception {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(User uesr) throws Exception {
		// TODO Auto-generated method stub

	}

	@Override
	public void updateInteger(String userid, String integral) throws Exception {
		// TODO Auto-generated method stub

	}

	@Override
	public void updateUserPwd(String userid, String userPwd) throws Exception {
		// TODO Auto-generated method stub

	}

}
